﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XianboSite.Utility;
using System.IO;
using System.Drawing;

namespace XianboSite.Controllers
{
    public class ContextController : Controller
    {
        //
        // GET: /Context/

        public ActionResult Index()
        {
            return View();
        }

        public ActionResult Picture(string url)
        {
            Bitmap image = null;
            using (FileStream stream = new FileStream(url, FileMode.Open))
            {
                image = new Bitmap(stream);
            }
            return new ImageResult(image);
        }

        public ActionResult File(string url)
        {
            Response.AddHeader("Content-Disposition", "attachment;");
            return File(Server.MapPath(url), "application/msword", "中期分析报告3-22.doc");
            //return File(Server.MapPath(@"~/files/中期分析报告3-22.doc"), "application/msword", "中期分析报告3-22.doc");
        }
    }
}
